using System.Collections.Generic;
using TemplatesDatabase;

namespace Game
{
	public class SubsystemLJBlockBehaviors : SubsystemBlockBehaviors
	{
		protected override void Load(ValuesDictionary valuesDictionary)
		{
			SubsystemBlockBehavior[][] array = new SubsystemBlockBehavior[BlocksManager.Blocks.Length][];
			Dictionary<int, List<SubsystemBlockBehavior>> dictionary = new Dictionary<int, List<SubsystemBlockBehavior>>();
			for (int i = 0; i < array.Length; i++)
			{
				dictionary[i] = new List<SubsystemBlockBehavior>();
			}
			List<SubsystemBlockBehavior> list = ReflectionUtils.GetField((object)this, "m_blockBehaviors") as List<SubsystemBlockBehavior>;
			foreach (SubsystemBlockBehavior item in base.Project.FindSubsystems<SubsystemBlockBehavior>())
			{
				list.Add(item);
				int[] handledBlocks = item.HandledBlocks;
				foreach (int key in handledBlocks)
				{
					dictionary[key].Add(item);
				}
			}
			for (int k = 0; k < array.Length; k++)
			{
				array[k] = dictionary[k].ToArray();
			}
			ReflectionUtils.SetField((object)this, "m_blockBehaviorsByContents", (object)array);
		}
	}
}
